package mode

import (
	"time"

	"gorm.io/gorm"
)

type Db_roles struct {
	gorm.Model
	Name    string `json:"name" gorm:"size:10;not null;unique"`
	Desc    string `json:"desc" gorm:"size:50;not null;"`
	Disable int    `json:"disable" gorm:"type:integer;not null;default:1"`
	// User    []Lz_user `json:"-" gorm:"many2many:Users_Roles;joinForeignKey:Role_Id;joinReferences:User_Id"`
	Perm []Db_pm `json:"perm" gorm:"many2many:Roles_Pm;joinForeignKey:Role_Id;joinReferences:Pm_Id"`
}

// 使用自定义外表
type Users_Roles struct {
	User_Id   string    `json:"user_id" gorm:"primaryKey"`
	Role_Id   string    `json:"role_id" gorm:"primaryKey"`
	CreatedAt time.Time //自定义添加一个创建时间字段
}
